// 获取当月第一天
export function getMonthFirstDay(){
    var date = new Date();
    date.setDate(1);
    var month = parseInt(date.getMonth()+1);
    var day = date.getDate();
    if (month < 10) {
        month = '0' + month
    }
    if (day < 10) {
        day = '0' + day
    }
    return date.getFullYear() + '-' + month + '-' + day
    // 格式：2020-01-01
}

// 获取当月最后一天
export function getMonthLastDay(){
    var endDate=new Date();
        var currentMonth=endDate.getMonth();
        var nextMonth=++currentMonth;
        var nextMonthFirstDay=new Date(endDate.getFullYear(),nextMonth,1);
        var oneDay=1000*60*60*24;
        var lastTime = new Date(nextMonthFirstDay-oneDay);
        var endMonth = parseInt(lastTime.getMonth()+1);
        var endDay = lastTime.getDate();
        if (endMonth < 10) {
            endMonth = '0' + endMonth
        }
        if (endDay < 10) {
            endDay = '0' + endDay
        }
        return endDate.getFullYear() + '-' + endMonth + '-' + endDay
}